package com.dormitory.Servlet;

import com.alibaba.fastjson.JSONObject;
import com.dormitory.dao.selectInformation;
import com.dormitory.entity.vo;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
@WebServlet(name = "Servlet.absenceStudentServlet", value = "/Servlet.absenceStudentServlet")
public class absenceStudentServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        selectInformation selectInformation =new selectInformation();
        try {
            List<Object> list= selectInformation.getStudent("select * from student where 状态='缺勤'");
            resp.setContentType("text/html;charset=utf-8");
            vo v=new vo();
            v.setCode(0);
            v.setMsg("success");
            v.setCount(list.size());
            v.setData(list);
            resp.getWriter().write(JSONObject.toJSON(v).toString());
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}